#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableSceneDogzDao:DaoBase<TableSceneDogz>
    {
        public override string GetFileName()
        {
            return "TableSceneDogz.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableSceneDogz>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableSceneDogz model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.dogzId)) UnityEngine.Debug.LogError("数据表id重复:TableSceneDogz->id: " + model.dogzId);
            #endif
            cachePrimaryInt[model.dogzId] = model;
        }
        protected override TableSceneDogz ParseRowData(string[] rowData)
        {
            TableSceneDogz data = new TableSceneDogz();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.dogzId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.modelId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.followRadius = float.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.offset = ParseData<float>(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.patrolArea = float.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.patrolSpeed = float.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.starLimit = int.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.standbyAction = ParseData(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.interval = float.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.patrolweight = int.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.standbyWeight = int.Parse(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.shareRotation = int.Parse(rowData[11]);
            }
            return data;
        }
    }
}
